-
Notifications
You must be signed in to change notification settings - Fork 56
add minimum key size checks and warnings #81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Note: This is still unmerged because something about the tests I added are making Travis fail... I'll be looking into that this week. |
rebased on top of recent changes; still trying to figure out why this kills Travis... |
* allow integration test utils to import without convenience imports when imported from examples tests * rework examples tests to perform relative imports of examples rather than patching the path * specify test directory to re-enable examples tests
Changes made to:
|
...looks like Travis is still crashing, which tells me it's probably the helpers I added, not the actual tests...for the short-term fix I think I'll try just dropping the Travis runs to the "fast" runs instead of "slow"... |
_test = JceNameLocalDelegatedKey.generate(algorithm, key_bits) | ||
|
||
logging_results = capturing_logger.getvalue() | ||
assert (too_short and error_message in logging_results) or (not too_short and error_message not in logging_results) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not going to block on this, but nested list comprehensions can make this code hard to parse.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@karlw00t That's not a list comprehension, it's just two boolean checks
It just compressed this:
if too_short:
assert error_message in logging_results
else:
assert error_message not in logging_results
to this:
assert (too_short and error_message in logging_results) or (not too_short and error_message not in logging_results)
|
||
|
||
@pytest.fixture | ||
def capturing_logger(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why can't we use Capture Log here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like they don't document it, but yes, we can use that.
The undocumented bit is that you can actually get the logged data[1].
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought I remembered this being somewhere else...turns out this is part of pytest now.
Need to re-review changes in recent updates
In updating to use pytest's built-in |
Issue #, if available: #78
Description of changes:
We now log a warning if you create or load an HMAC key shorter than 128 bits or a RSA key shorter than 2048 bits.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.